% TEST_ID: LANG-EXPAND-0021
% CATEGORY: language/array-ops/modify
% 测试不同类型的数组之间的赋值行为

function test_cast_modify
    a(2, 2) = struct('a', 1);
    assert(isequal(size(a), [ 2, 2 ]));
    assert(isequal(class(a), 'struct'));

    a = [ "ad", "fads" ];
    a(1) = 'bds';
    assert(isequal(a, [ "bds", "fads" ]));
    a(1, 2) = 'cf';
    assert(isequal(a, [ "bds", "cf" ]));
    a(1 : 2) = ['abc'; 'abc'];
    assert(isequal(a, [ "abc", "abc" ]));
    a(1 : 3) = 'abc';
    assert(isequal(a, [ "abc", "abc", "abc" ]));

    clear a;

    a = [];
    a(2,3) = single(2);
    assert(a(end) == 2);
    assert(isequal(class(a), 'double'));

    a = [];
    a{3} = [2 1];
    assert(isequal(a{end}, [2 1]));
    assert(isequal(class(a), 'cell'));
end